home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / c-lines.zip / C_LINES.DOC < prev    next >
Text File  |  1992-01-28  |  5KB  |  86 lines

  1.     c_lines is a program to find some ( very ) basic statistics about c
  2. programs. These statistics include the number of lines devoted to each
  3. of the following:
  4.  
  5.     1) comments
  6.     2) pre-processor directives
  7.     3) areas that are being explicitly ignored with "#if 0" direcitves.
  8.     4) actual code.
  9.  
  10.     Note that only explicit removal with "#if 0" directives, makes the
  11. code inactive from the viewpoint of this program.  Other pre-processor
  12. directives that eliminate the compilation of sections of code are
  13. counted as pre-processor directives, but are otherwise ignored.  These
  14. are usually included for portability, and all the code in question is
  15. meant to be used, just in different environments, therefore the program
  16. considers all of them to be active, even if they are in mutually
  17. exclusive sections.  This code has been fairly extensively tested ( ie.
  18. on several thousand lines of code from various sources. ) and seems to
  19. work correctly on all of them.  If you do have problems, about the only
  20. way to get ahold of the author is to leave a message in the C_ECHO or
  21. C_PLUSPLUS echo on FIDO-NET.  It should be addressed TO: JERRY COFFIN.
  22. You might also send netmail to me at 1:128/60.
  23.  
  24.     The program is used by supplying the names of files you want
  25. analyzed on the command line.  You can use wildcards if you wish.
  26. If you don't supply a file name, it will attempt to read from standard
  27. input IF it has been re-directed.  It will not attempt to read from the
  28. keyboard.  If you haven't redirected input, and don't supply at least
  29. one argument, it prints a short help message. If supply an incomplete
  30. file-name, ( ie. one with no extension ) the following extensions will
  31. be searched in this order: 1) .c 2) .cpp 3) .cxx 4) .cc 5) .h 6) .hpp 7)
  32. .hxx
  33.  
  34.     I believe this is sufficient to accomodate the file names used by
  35. most c and c++ compilers.  If you need others, leave a messge as noted
  36. above, but please don't expect instant response; I have a job during the
  37. day and don't always get to spend as much time programming as I'd like.
  38. I'm thinking about adding the ability to analyze c source code imbedded
  39. in lex and yacc type input files, so if you want/need/have use for this
  40. capability, let me know, and it may become a higher priority.
  41.  
  42. I should note that there is a discrepency between C source code
  43. included, and the code Flex will generate for c_lines.l, unless you
  44. modify flex.ske.  I've added a little code to turn any high-bit
  45. characters ( ones with a code higher than 127/0x7F ) into spaces.
  46. Without this, it will crash on any program that includes high-bit
  47. characters.  As far as I know, these should only be included in string
  48. or character constants, so changing them to spaces should have on effect
  49. on the analysis.
  50.  
  51.     For the curious: this was written with FLEX, the lexical analyzer
  52. generator developed as part of the GNU project.  I believe it counts as
  53. what is described as a "derived work" of that project, which means that
  54. I have to make the source code available to you if you want it.  If you
  55. re-distribute it, the same restriction applies.  The actual source in
  56. c_lines.l is Public Domain, so if you use a different lexical analyzer
  57. generator, you can do with it's output as you like ( within it's
  58. restrictions, if any. )  I've included the source code in the file
  59. "c_lines.l" which should be a little over 4 K long when uncompressed. If
  60. you want to re-build this program, a copy of Flex, lex, or another
  61. lexical analyzer generator will be needed.  The lexical analyzer must be
  62. able to handle what are called "starting contexts" or it won't work with
  63. this.  For one instance, Allen Holub's LeX won't work.
  64.  
  65. Other than the restricion mentioned above, you're welcome to treat the
  66. code as your own.  You're welcome to give away all the copies you want
  67. to.  If you sell any copies, I'd appreciate any portion of the money you
  68. feel like sending me.  If you modify or improve this program, I'd
  69. appreciate hearing about it and/or recieving a copy of the improved
  70. version, if it isn't a big hassle.  Actually, more exciting to me than
  71. that would be if you mentioned my name as being an excellent programmer,
  72. since that feeds my ego, and if done correctly, might even get me a job
  73. programming, which would be a distinct improvement over $4.36/Hr. at
  74. Taco Bell, where I work now.
  75.  
  76.     The C source code compiles with MS QC 2.51 and Borland C++ 2.0.  It
  77. will also probably work with other compilers from these vendors, but
  78. there's no guarantee of that.  It's been tested pretty extensively with
  79. with the output from Quick C, but less so with the output from Borland
  80. C.
  81.  
  82.     Enjoy it, okay ?  :-)  And try bungee jumping, it's a blast !   You
  83. need to get away from the keyboard more often !
  84.         Later,
  85.         Jerry.
  86.